package com.itheima.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.itheima.mapper.ReportIncomeMapper;
import com.itheima.service.ReportIncomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @Description:
 * @Version: V1.0
 */
@Service(interfaceClass = ReportIncomeService.class)
@Transactional
public class ReportIncomeServiceImpl implements ReportIncomeService {
    @Autowired
    private ReportIncomeMapper reportIncomeMapper;


    public List<Map<String, Object>> action() {
        return reportIncomeMapper.findMealAndCount();
    }


    public List<Map<String, Object>> action(List<Date> dateValue) {
        Date startDate = dateValue.get(0);
        Date endDate = dateValue.get(1);
        return reportIncomeMapper.findMealAndCountByDate(startDate,endDate);
    }
}
